<template>
	<view style="height: 100%;">
		<view>
			<van-popup position="center" :show="canShow" z-index="221211212" overlay custom-style="background: rgba(1,1,1,0);">
				<view style="text-align: center;">
					<image :src="youxueImg" style="width: 750rpx;height: 712rpx;" @tap="activityFun"></image>
					<image :src="chazi" style="width: 67rpx;height: 67rpx;" @tap="disFun"></image>
				</view>
			</van-popup>
		</view>
		<view class="shouye_content" v-if="index == 1" >
			<view style="width: 100%;">
				<image :src="biao_tou" mode=""  style="width:750rpx;height:332.8rpx;"></image>
			</view>
			<view>
				<view style="position: fixed;top: 0;width: 100vw;z-index: 121211212;">
					<view style="box-sizing: border-box;">
						<view  :style="{height: heightData}">
							<view :style="{background: styData}">
								<view :style="{lineHeight: lin}">
									<view :style="{paddingTop: pad}">
										<view :style="{color:colorDiscol}">
											<view style=" display: flex;align-items: center;width: 400rpx;margin-left: 20rpx;" @tap="openMapGetLocation">
												<image :src="dingwei" mode="" style="width: 24.77rpx;height: 29.58rpx;z-index: 121212;"></image>
												<p style="font-size: 26rpx;text-align: left;width: 370rpx;margin-left: 10rpx;z-index: 121212;" >
													<text :style="{fontSize: fontSize}">{{rough}}</text>
												</p>
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view :style="{top: bacnnerTop}" class="bannerCla">
				<swiper :autoplay="autoplay" :interval="interval"  circular @change="banner_index" style="width: 100vw;height: 275rpx;vertical-align: middle;border-radius: 25rpx;display: flex;justify-content: center;align-items: center;">
					 <swiper-item  v-for="(itme,index) in banner_list" :key="index" @tap="goPoster(itme)" style="width: 695rpx;height: 275rpx;vertical-align: middle;border-radius: 25rpx;">
						<image :src="itme" style="width: 695rpx;height: 275rpx;vertical-align: middle;border-radius: 25rpx;"></image>
					 </swiper-item>
				</swiper>
				<view class="zhishidian">
					<view class="xia" :style="{left:tran_yi + 'rpx'}">
						<view v-for="(itme,index) in banner_list" :key="index" class="kuai" :style="[{background:(suoyin == index? '#FF7300' : '#FFFFFF' )}]"></view>
					</view>
				</view>
			</view>
			<view style="position: relative;width: 750rpx;">
				<view class="daohang" :style="{marginTop: PeterTop}">
					<scroll-view scroll-x="true" class="kite-classify-scroll" @scrolltolower="scrolltolower" @scrolltoupper="scrolltoupper">
						<view class="kite-classify-cell" v-for="(itme,index) in imgArr" :key="index" style="font-size: 30rpx;" @tap="goshuju(itme.name)">
							<view style="display: flex;align-items: center;flex-direction: column;">
								<image :src="itme.img" mode="" style="width: 90rpx;height: 90rpx;"></image>
								<view style="font-size: 30rpx;margin-top: 20rpx;color: #424242;letter-spacing: 1rpx;font-weight: bold;">{{itme.name}}</view>
							</view>
						</view>
					</scroll-view>
				</view>
				<view style=" position: absolute;border-radius: 4rpx;left: 375rpx;top: 205rpx;">
					<view style="display: flex;position: absolute;left: -33rpx;">
						<view v-for="(itme,index) in guang" :key="index" :style="[{background:(jingang_list_num == index?'#FF7300':'#E5E5E5')}]" class="bun"></view>
					</view>
				</view>
			</view>
			<view style="width: 694rpx;box-sizing: border-box;padding:  0;margin: 27rpx;border-radius: 25rpx;display: flex;justify-content: space-between;align-items: center;">
				<view>
					<image :src="danjie_img" class="huodong_img" @tap="danjie"></image>
				</view>
				<view>
					<image :src="pintuanfanxian_img" class="huodong_img" @tap="pintuan"></image>
				</view>
			</view>
			<view style="width: 694rpx;box-sizing: border-box;padding:  0;margin: 27rpx;border-radius: 25rpx;display: flex;justify-content: space-between;align-items: center;">
				<image :src="xinchun_img" style="width: 694rpx;height: 131rpx;" @tap="threeSubjectsSignupJump"></image>
			</view>
			<view class="jigoure">
				<view class="biaoti">
					<view style="font-size: 35rpx;">天赋课程</view>
					<view style="font-size: 28.15rpx;color: #BBBBBB;" @tap.stop="gotokecheng_danjie">更多
						<image :src="zhijian" mode="" style="width: 14.08rpx;height: 20.52rpx;margin-left: 12.67rpx;"></image>
					</view>
				</view>
				<scroll-view style="min-height: 413.7rpx;width: 650rpx;box-sizing: border-box;"  >
					<view v-for="(itme,index) in jigou_ke" :key="index" @tap="gokechengxiang(itme)">
						<view style="display: flex;" class="box_wai">
							<view class="img">
								<image :src="itme.face_url" class="img"></image>
								<view class="categories_child">{{itme.categories_child}}</view>
								<view class="vertical" v-if="itme.is_attend_activities">
									<image :src="quan_" mode="widthFix" style="width: 170rpx;vertical-align: bottom;"></image>
								</view>
							</view>
							<view style="margin-left: 20rpx;">
								<view style="font-size: 27rpx;font-weight: bold;">{{itme.NewTitle}}</view>
								<view style="display: flex;justify-content: space-between;align-items: center;height: 37rpx;margin:20rpx 0;">
									<view style="display: flex;align-items: center;position: relative;">
										<view style="color: #FF3D3D;font-weight:bold ;">
											<text style="font-size:20rpx;">￥</text>
											<text style="font-size:33rpx;margin: 0 5rpx;">{{itme.amout}}</text>
										</view>
									</view>
								</view>
								<view style="display: flex;justify-content: space-between;width: 400rpx;align-items: center;">
									<view style="font-size: 25rpx;color: #AEAEAE;">已售{{itme.pay_num}}</view>
									<view style="font-size: 25rpx;color: #AEAEAE;">距离{{itme.newDistance}}km</view>
								</view>
							</view>
						</view>
						<view style="height: 2rpx;width: 680rpx;background: #F5F5F5;margin: 30rpx 0;"></view>
					</view>
				</scroll-view>
			</view>
			<view class="xinjihou">
				<view class="biaotix">
					<view style="font-size: 35rpx;">热门教师</view>
					<view style="font-size: 28.15rpx;color: #BBBBBB;" @click="gokecheng">更多
					   <image :src="zhijian" mode="" style="width: 14.08rpx;height: 20.52rpx;margin-left: 12.67rpx;"></image>
					</view>
				</view>
				<view class="xinjigou_">
					 <view class="my_regs">
						<view v-for="(itt,index) in teacherListData" :key="index" style="margin-right: 19.93rpx;position: relative;background: #FFFFFF;text-align: center;display: flex;flex-direction: column;align-items: center;padding: 20rpx 0;border-radius: 15rpx;" @tap="xiangqing_(itt)">
							<image :src="itt.photo" style="width: 180rpx;height: 180rpx;border-radius: 50%;vertical-align: top;"></image>
							<view style="margin-top: 20rpx ;width:223.47rpx;font-size: 30rpx;color: #414141;font-weight: 1000;text-align: center;">
								<view style="color: #FF7300;">{{itt.full_name}}</view>
								<view style="color: #FF7300;font-size: 20rpx;">{{itt.categories_child}}</view>
							</view>
							<view style="width: 150rpx;height: 50rpx;text-align: center;line-height: 50rpx;color: #FFFFFF;background: #FF7300;border-radius: 25rpx;font-size: 28rpx;margin-top: 30rpx;">
								查看
							</view>
						</view>
					 </view>
				</view>
			</view>
			<view class="tuijiankecheng">
				<view style="margin-left: 50rpx;font-weight: bold;font-size: 35rpx;">热门机构</view>
				<view class="tuijiankecheng_" v-for="(itme,index) in list_jigou_huan" :key="index">
					<view style="display: flex;" @tap.stop="xiangqing(itme)">
						<view style="position: relative;">
							<image :src="itme.mechanism_logo" style="width: 195.02rpx;height: 195.02rpx;border-radius: 20rpx;border: #D6D6D6 0.09rpx solid;vertical-align: top;margin: 0;"></image>
							<view style="position: absolute;top: 0;left: 0;z-index: 12121;min-width: 70.7rpx;height: 35rpx;text-align: center;line-height: 35rpx;color: #FFFFFF;font-size: 20rpx;border-radius: 20rpx 0 20rpx 0 ;background: #FF3D3D;padding: 0 10rpx;">{{itme.categories_child}}</view>
						</view>
						<view style="margin-left: 24.153rpx;width: 380rpx;box-sizing: border-box;padding-right: 20rpx;"> 
							<view style="font-size: 33rpx;color: #414141;font-weight: bold;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;width: 380rpx;">{{itme.mechanism_name}}</view>
							<view style="height: 30.8rpx;margin: 15rpx 0 15rpx 0;display: flex;align-items: center;">
								<view>
									<van-rate  :value="itme.avg_rating"></van-rate>
								</view>
								<view style="font-size: 25.717rpx;font-weight: bold;color: #474747;white-space:wrap;">
									<text >{{itme.juli}}</text>
									<text>km</text>
								</view>
							</view>
							<view style="font-size: 25.95rpx;color: #BEBEBE;width:inherit;white-space:wrap;display:block;   white-space:normal;">
							   {{itme.mechanism_addr}}
							</view>
						</view>
					</view>
					<view v-if="itme.bealue" style="margin-top: 30rpx;">
						<view v-for="(itmes,indexs) in itme.tujian" :key="indexs" @tap="gokechengxiang(itmes,itme)">
							<view style="display: flex;align-items: center;justify-content: space-between;height: 30rpx;">
								<view style="display: flex;align-items: center;height: 40rpx;">
									<view style="width: 120rpx;height: 40rpx;background: #FF492B;color: #FFFFFF;font-size: 20rpx;line-height: 40rpx;text-align: center;border-radius: 15rpx;">热门推荐</view>
									<view style="font-size: 25rpx;font-weight: bold;">{{itmes.biao}}</view>
								</view>
								<view style="color: #F65454;height: 40rpx;position: relative;top: -10rpx;">
									<text style="font-size: 15rpx;">￥</text>
									<text style="font-size: 28rpx;font-weight: bold;">{{itmes.original_price}}</text>
									<text style="font-size: 22rpx;">/节</text>
								</view>
							</view>
							<view style="height: 2rpx;width: 100%;background: #F5F5F5;margin: 30rpx 0;" v-if="itmes.shuzu_biao"></view>
						</view>
						<view style="width: 100%;text-align: center;font-size: 28rpx;color: #C7C7C7;margin-top: 30rpx;" @tap="gengduoke(itme)" v-if="itme.gengduo">查看更多数据
							<image :src="zhijian" mode="" style="width: 16.08rpx;height: 20.52rpx;margin-left: 12.67rpx;vertical-align: middle;"></image>
						</view>
					</view>
				</view>
				<view v-if="res_ == 1" style="display: flex;height: 60rpx;width: 750rpx;justify-content: center;align-items: center;margin-bottom: 30rpx;border-top:0.5rpx solid  #F5F5F5;">
					<view>
						<van-loading type="spinner" color="#323233" size="25"/>
					</view>
					<view style="color: #323233;margin-left: 10rpx;font-size: 30rpx;">努力加载中...</view>
				</view>
			</view>
		</view>
		<view class="shouye_content" v-if="index == 2" style="top: 0;height: 100%;">
			<friend></friend>
		</view>
		<view class="shouye_content" v-if="index == 4" style="position: absolute;top: 0;height: 100%;">
			<dingdan></dingdan>
		</view>
		<view  class="shouye_content" v-if="index == 5" style="position: absolute;top: 0;height: 100%;">
			<shouji></shouji>
		</view>
		<view class="shouye_content" v-if="index == 6" style="position: absolute;top: 0;height: 100%;">
			<paike></paike>
		</view>
		<view class="shouye_content" v-if="index == 7" style="position: absolute;top: 0;height: 100%;">
			<jigoudingdan></jigoudingdan>
		</view>
		<view class="shouye_content" v-if="index == 3" style="height: 100%;">
			<jigou></jigou>
		</view>
		<view style="height: 83.38rpx;width: 750rpx;box-sizing: border-box;padding-left:0 10px ;">
			<pa :currentPage="chuanzhi" @fan="fan" :tubiao="index"></pa>
		</view>
		
	</view>
</template>
<script>
	export default{
		 onShareAppMessage(res) {
		    if (res.from === 'button') {
		      console.log(res.target)
		    }
		    return {
		      title: '教付保'
		    }
		  },
		data(){
			return{
				chazi: "http://img.curiousmore.com/109735832644",
				youxueImg: "http://img.curiousmore.com/195262049430",
				danjie_zhifu: "http://img.curiousmore.com/77010182660",
				pingtuan_img: "http://img.curiousmore.com/172161",
				xinchun_img: "http://img.curiousmore.com/317554600762",
				danjie_img: "http://img.curiousmore.com/535908",
				pintuanfanxian_img: "http://img.curiousmore.com/411024",
				sou: "http://img.curiousmore.com/971276",
				xiahua: "http://img.curiousmore.com/441705",
				dingwei: "http://img.curiousmore.com/832539",
				zhijian: "http://img.curiousmore.com/578648",
				quan: "http://img.curiousmore.com/65584",
				biao_tou: "http://img.curiousmore.com/677938",
				huodong:"",
				num_list: 121212,
				maskAlpha: 0.7,
				bgColor:"transparent",
				jingang_list_num:0,
				guang:[1,2],
				suoyin:0,
				tran_yi:"",
				indicatorDots: true,
				autoplay: true,
				interval:3000,
				duration: 500,
				li:2,
				res_:1,
				num_:1,
				index:1,
				chuanzhi:1,
				num:12,
				chuanzhu_shou:100,
				imgArr:[
					{
						img:'http://img.curiousmore.com/854951',
						name:"附近"
					},
					{
						img:'http://img.curiousmore.com/228977',
						name:"才艺"
					},
					{
						img:'http://img.curiousmore.com/646538',
						name:"体育运动"
					},
					{
						img:'http://img.curiousmore.com/953117',
						name:"教辅学科"
					},
					{
						img:'http://img.curiousmore.com/634944',
						name:"益智"
					},
					{
						img:'http://img.curiousmore.com/921705',
						name:"其他"
					}
				],
				longitude:"",
				latitude:"",
				jigou_ke:[],
				xinjifou_ke:[],
				id:"",
				dad:{},
				lei_con:"",
				jingdu:"",
				weidu:"",
				banner_list:[],
				xuanze_jigou: ["距离排序","最新排序"],
				xuance_shuju_num: 0,
				xin_ji_gou: [],
				list_jigou_huan:[],
				userif_list: "",
				isshow: false,
				img_img_list: "http://img.curiousmore.com/262721",
				img_list_todo: "http://img.curiousmore.com/139505842047",
				chahao: "http://img.curiousmore.com/484279",
				list_todo: false,
				xiamian_todo: "http://img.curiousmore.com/207297347680",
				tupian: "http://img.curiousmore.com/603975",
				key: "SWPBZ-NPE3S-TXFON-6PJQC-55L5V-2UBAC",
				// 腾讯的key值
				rough: "",
				distanceTopValueJudge: false,
				teacherListData: [],
				topDistance: "",
				bacnnerTop: "",
				PeterTop: "",
				numData: 0,
				styData: "",
				locationHei: "",
				paddingTop: "",
				colorDiscol: "#ffffff",
				canShow: true,
				loginToken: "",
				heightData: "",
				pad: "",
				lin: "",
				fontSize: "26rpx"
			}
		},
		
		onLoad(option) {
			
				let me = this
				if(option.num){
					me.index = option.num
				}
				
				try{
					if(uni.getStorageSync('userif_list')){
						this.dad = uni.getStorageSync('userif_list')
						this.loginToken = uni.getStorageSync('user_token')
						if(uni.getStorageSync('lingqu')){
							this.huodong = uni.getStorageSync('lingqu')
						}
						if(!this.dad.is_collection && this.huodong == ""){
							setTimeout(() => {
								me.list()
							},3000)
						}
					}else{
						setTimeout(() => {
							me.list()
						},3000)
					}
					if(uni.getStorageSync('shenfen_')){
						this.chuanzhu_shou = uni.getStorageSync('shenfen_')
					}
				}catch(e){console.log(e)}
				setTimeout(() => {
					var data = wx.getMenuButtonBoundingClientRect()
					let  heightData,variable
					uni.getSystemInfo({
					 	success(res) {
							variable  = 750/res.windowWidth
							if(res.model.indexOf("iPad") !== -1) {
								me.fontSize = "20rpx"
							}
					 	}
					})
					heightData = variable*data.top + variable*data.height + 'rpx'
					this.heightData = heightData
					this.pad = variable*data.top + 'rpx'
					this.lin = variable*data.height +　'rpx'
					this.topDistance = data.top*2.2 + 'rpx'
					this.bacnnerTop = data.top*2.2 + data.height*2.2 + 20
					this.locationHei = data.height*2.2 + "rpx"
					this.paddingTop = data.top*2.2 + "rpx"
					this.PeterTop = this.bacnnerTop + 290 + 15 - 338 + "rpx"
					this.bacnnerTop += "rpx"
				},100)
				me.banner()
				me.getLocationInfo()
			
				let mechanism_id = this.dad.mechanism_id 
				let can = this.chuanzhu_shou
				if(this.chuanzhu_shou != 100){
					if(this.chuanzhu_shou == 33){
						this.chuanzhi = 1
						this.index = 1
					}else if(this.chuanzhu_shou == 55){
						this.chuanzhi = 2
						this.index = 3
				}else{
					this.chuanzhi = 1
					this.index = 1
				}
			}
			this.queryTeacherListRequest()
		},
		
		onShow() {
			
		},
		
		onPageScroll(res){
			if(res.scrollTop < 10){
				this.colorDiscol = "#FFFFFF"
			}else{
				this.colorDiscol = "#FF9324"
			}
			if(res.scrollTop > 10){
				this.distanceTopValueJudge = true
			}else {
				this.distanceTopValueJudge = false
			}
			if(res.scrollTop >= 0 && res.scrollTop <= 3) {
				this.numData = 0
			}else if(res.scrollTop > 3 && res.scrollTop <= 6) {
				this.numData = 0.1
			}else if(res.scrollTop > 6 && res.scrollTop <= 9) {
				this.numData = 0.2
			}else if(res.scrollTop > 9 && res.scrollTop <= 12) {
				this.numData = 0.3
			}else if(res.scrollTop > 12 && res.scrollTop <= 15) {
				this.numData = 0.4
			}else if(res.scrollTop > 15 && res.scrollTop <= 18){
				this.numData = 0.5
			}else if(res.scrollTop > 18 && res.scrollTop <= 21) {
				this.numData = 0.6
			}else if(res.scrollTop > 24 && res.scrollTop <= 27) {
				this.numData = 0.7
			}else if(res.scrollTop > 30 && res.scrollTop <= 33) {
				this.numData = 0.8
			}else if(res.scrollTop > 36 && res.scrollTop <= 39) {
				this.numData = 0.9
			}else if(res.scrollTop > 39){
				this.numData = 1
			}
			this.styData = 'rgba(255, 255, 255,' + this.numData + ')'
		},
		
		onReachBottom(){
			if(this.res_ == 1){
				this.num_++
				this.xinjigou()
			}
		},
		methods:{
			
			// 首页轮播图跳转到海报分享页面
			goPoster(itme) {
				
				if(itme === "http://img.curiousmore.com/8dc79395-dfbd-9ff9-1c4d-599c48c49f16" &&  this.loginToken !== "") {
					uni.navigateTo({
						url:"/pages/Other/shaixuan/shaixuan"
					})
				}else {
					uni.reLaunch({
						url:'/pages/tabBer/login/logins'
					})
				}
			},
			
			code() {
				uni.login({
					success:(res) => {
						console.log(res.code)
					}
				})
			},
			activityFun() {
				if(Object.keys(this.dad).length === 0){
					uni.navigateTo({
						url: "/pages/tabBer/login/logins"
					})
				}else {
					uni.navigateTo({
						url:"/pages/Other/shaixuan/shaixuan"
					})
					this.canShow = false
				}
			},
			
			disFun() {
				this.canShow = false
			},
			// 天赋课程数据请求
			threeSubjectsActivityListRequest() {
				this.$myRequest({
					url: "/masterSetPrice/queryActivityListPageByType",
					data: {
						pageSize: 10,
						currentPage: 1,
						status: 2,
						type: "experience_specials",
						latitude: this.weidu,
						longitude: this.jingdu
					}
				}).then((val) => {
					val.data.forEach((itme) => {
						itme.NewTitle =  "【" + itme.course_num + "节" + "】" + itme.title
						itme.newDistance = Math.round(this.getDistance(this.weidu,this.jingdu,itme.latitude,itme.longitude))
						if(itme.map.masterMechanismEntity.categories_child.length >= 5){
							itme.categories_child = itme.map.masterMechanismEntity.categories_child.substring(0,6)
						}else {
							itme.categories_child = itme.map.masterMechanismEntity.categories_child
						}
					})
					this.jigou_ke = val.data
				})
			},
			
			queryTeacherListRequest() {
				this.$myRequest({
					url: "/masterInfo/queryTeachPayByEs",
					data: {
						type: "teach_paypal",
						pageSize: 10,
						currentPage: 1,
						status: 2
					}
				}).then((res) => {
					this.teacherListData = res.data
				})
			},
			
			openMapGetLocation() {
				let me = this
				uni.chooseLocation({
					success: (res) => {
						this.rough = res.name
						try{
							uni.setStorageSync('storage_key', res);
						}catch(e){}
						me.jingdu = res.longitude
						me.weidu = res.latitude
						me.num_ = 0
						me.list_jigou_huan = []
						me.xinjifou_ke = []
						me.xinjigou()
						// me.jingbei_ke()
						me.threeSubjectsActivityListRequest()
						me.xin_ji()
					}
				})
			},
			
			getLocationInfo() {
				let me = this
				uni.getLocation({
				    type: 'gcj02',
				    success: function (res) {
						try{
							uni.setStorageSync('storage_key', res);
						}catch(e){}
						me.jingdu = res.longitude
						me.weidu = res.latitude
						me.xinjigou()
						me.threeSubjectsActivityListRequest()
						me.xin_ji()
						try {
							let location = uni.getStorageSync("storage_key")
							uni.request({
								method: "get",
								data: {},
								url: "https://apis.map.qq.com/ws/geocoder/v1/?location=" + location.latitude + "," + location.longitude + "&key=SWPBZ-NPE3S-TXFON-6PJQC-55L5V-2UBAC&get_poi=1&poi_options=policy=2",
								success: (res) => {
									me.rough = res.data.result.pois[0].title
								},
								fail: (err) => {
									uni.showModal({
										title: "数据"
									})
									me.rough = "未授权，点击获取当前位置"
								}
							})
						}catch(e){}
				    },
					fail:() => {
						let res = {}
						res.longitude = 120.20523
						res.latitude = 30.25727
						try{
							uni.setStorageSync('storage_key', res);
						}catch(e){}
						me.jingdu = res.longitude
						me.weidu = res.latitude
						me.xinjigou()
						// me.jingbei_ke()
						me.threeSubjectsActivityListRequest()
						me.xin_ji()
						uni.authorize({
							scope: "scope.userLocation",
							success: () => {
								me.getLocationInfo()
							}
						})
					}
				})
			},
			
			danjie(){
				// uni.navigateTo({
				// 	url: "/pages/Meet/ApplyList/ApplyList"
				// })
				uni.navigateTo({
					url:"/pages/Other/shaixuan/shaixuan"
				})
			},
			pintuan(){
				// uni.navigateTo({
				// 	url: "/pages/Meet/privateDetails/privateDetails"
				// })
				uni.navigateTo({
					url: "/pages/Other/setPass/setPass"
				})
			},
			threeSubjectsSignupJump(){
				uni.navigateTo({
					url: "/pages/Meet/CreateClass/CreateClass"
				})
			},
			gengduoke(itme){
				uni.navigateTo({
					url: "/pages/Friend/groupTalk/groupTalk?id=" + itme.id
				})
			},
			gosousuo(){
				uni.navigateTo({
					url:"/pages/Friend/addFriend/addFriend"
				})
			},
			guanbi(){
				this.list_todo = false
			},
			list(){
				this.list_todo = true
			},
			go(){
				let me = this
				if(this.dad.hasOwnProperty("user_id")){
					this.$refs.popupsl.hide()
					uni.reLaunch({
						url:"/pages/Friend/newFriend/newFriend"
					}) 
				}else{
					uni.reLaunch({
						url:'/pages/tabBer/login/logins'
					})
				}
			},
			gotokecheng_danjie(){
				uni.navigateTo({
					url:"/pages/Friend/videoChat/videoChat"
				})
			},
			scrolltolower(e){
				this.jingang_list_num = 1
			},
			scrolltoupper(e){
				this.jingang_list_num = 0
			},
			xuance_shuju(index,itme){
				this.xuance_shuju_num =  index
				this.num_ = 1
				this.xinjifou_ke = []
				try{
					const val = uni.getStorageSync('storage_key')
					this.xinjigou()
				}catch(e){}
			},
			jisuan(){
				let me  = this
				let len = me.banner_list.length
				let zhishi_wid = (len*30.2) + ((len - 1)*15.5)
				me.tran_yi = -zhishi_wid/2 
			},
			banner_index(e){
				this.suoyin = e.detail.current
			},
		async	banner(){
				let me = this
				const res = await me.$myRequest({
					url:"/exhibitionPic/query",
					data:{
						type:"teach_pay",
						state:"1"
					}
				})
				res.data.forEach((itme) => {
					this.banner_list.push(itme.pic)
				})
				me.jisuan()
			},
			
			gokechengxiang(itme,itmes){
				uni.navigateTo({
					url: '/pages/World/classChannel/classChannel?curriculumId=' + itme.id
				})
			},
			
			goshuju(index){
				if(index == "才艺"){
					uni.navigateTo({
						url:"/pages/World/releaseText/releaseText"
					})
				}else if(index == "体育运动"){
					uni.navigateTo({
						url:"/pages/World/releaseVideo/releaseVideo"
					})
				}else if(index == "教辅学科"){
					uni.navigateTo({
						url:"/pages/World/searchCuriosity/searchCuriosity"
					})
				}else if(index == "益智"){
					uni.navigateTo({
						url:"/pages/World/earthDetail/earthDetail"
					})
				}else if(index == "附近"){
					uni.navigateTo({
						url:"/pages/Friend/waitClass/waitClass"
					})
				}else {
					uni.navigateTo({
						url:"/pages/Other/countrySelect/countrySelect"
					})
				}
			},
			xiangqing_(itt) {
				uni.navigateTo({
					url:'/pages/Meet/sijiaoList/sijiaoList?teacherId=' +  itt.id
				})
			},
				
			// },
			
			xiangqing(itt){
				uni.navigateTo({
					url:'/pages/Meet/jigouxiangqing/jigouxiangqing?id=' +  itt.id
				})
			},
			fan(index_){
				let me = this
				if(index_ == "我的"){
					this.index = 2
				}else if(index_ == "课程表"){
					this.index = 3
				}else if(index_ == "宝宝秀"){
					me.lei_con = index_
					this.index = 4
				}else if(index_ == "收益"){
					this.index = 5
				}else if(index_ == "排课表"){
					this.index = 6
				}else if(index_ == "订单"){
					this.index = 7
				}else{
					this.index = 1
					this.list_jigou_huan = []
					this.xinjifou_ke = []
					this.num_ = 1
					this.xinjigou()
				}
			},
			add(){
				this.index = 2
			},
			
			day(){
				this.index = 1
			},
			gokecheng(){
				uni.navigateTo({
					url: '/pages/xueke/kemu'
				})
			},
			async xin_ji(){
				let _this = this
				const res = await _this.$myRequest({
					url:'/mastermechanism/queryMechanismByType',
					methed:"GET",
					data:{
						pageSize:10,
						currentPage:1,
						sortName: "id",
						type:"teach_paypal",
						latitude:_this.weidu,
						longitude:_this.jingdu 
					}
				})
				let data = {
					title:"暂无课程",
					course_num:"",
					discount_amout:"",
					amout:""
				}
				if(res.data.length < 0){
					_this.res_ = 1
				}
				let a = []
				res.data.forEach((itme,index) => {
					if(itme.mechanism_logo == ""){
						res.data.splice(index,1)
					}
				})
				let b = res.data
				b.forEach((itme,index) => {
					if(itme.mechanism_name.indexOf("培训") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("培训","")
					}
					if(itme.mechanism_name.indexOf("机构") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("机构","")
					}
					if(itme.mechanism_name.indexOf("教育") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("教育","")
					}
					if(itme.mechanism_name.indexOf("教") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("教","")
					}
					if(itme.mechanism_name.indexOf("语") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("语","")
					}
					if(itme.mechanism_name.indexOf("学") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("学","")
					}
					if(itme.map != null){
						if(itme.map.masterSetPriceEntity.length == 0){
							itme.map.masterSetPriceEntity.push(data)
							itme.dis = false
						}else{
							itme.dis = true
						}
					}
					itme.juli = _this.getDistance(itme.latitude,itme.longitude,_this.weidu,_this.jingdu).toFixed(1)
				})
				 _this.xin_ji_gou = b
			},
			async xinjigou(){
				let _this = this
				const res = await _this.$myRequest({
					url:'/mastermechanism/queryMechanismByType',
					method:"GET",
					data:{
						pageSize:10,
						currentPage:_this.num_,
						latitude:_this.weidu,
						longitude:_this.jingdu,
						sortName:"is_recommend",
						type:"teach_paypal"
					}
				})
				let data = {
					title:"暂无课程",
					course_num:"",
					discount_amout:"",
					amout:""
				}
				if(res.data.length < 10){
					_this.res_ = 2
				}else{
					_this.res_ = 1
				}
				res.data.forEach((itme) => {
					if(itme.map != null  && itme.map.masterSetPriceEntity != null){
						if(itme.map.masterSetPriceEntity.length > 2){
							itme.gengduo = true
							itme.tujian =  itme.map.masterSetPriceEntity.slice(0,2)
						}else{
							itme.tujian =  itme.map.masterSetPriceEntity.slice(0,itme.map.masterSetPriceEntity.length)
							itme.gengduo = false
						}
					}
					if(itme.map.masterSetPriceEntity != null && itme.map.masterSetPriceEntity.length != 0 && itme.map != null){
						itme.bealue = true
						itme.map.masterSetPriceEntity.forEach((shu,indexss) => {
							shu.biao = "【" + shu.course_num + "节】" + shu.title
							if(indexss == 0){
								shu.shuzu_biao = true
							}else{
								shu.shuzu_biao = false
							}
						})
					}else if(itme.map == null || itme.map.masterSetPriceEntity == null || itme.map.masterSetPriceEntity.length == 0){
						itme.bealue = false
					}
				})
				let a = []
				let b = res.data
				b.forEach((itme,index) => {
					if(itme.mechanism_name.indexOf("培训") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("培训","")
					}
					if(itme.mechanism_name.indexOf("机构") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("机构","")
					}
					if(itme.mechanism_name.indexOf("教育") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("教育","")
					}
					if(itme.mechanism_name.indexOf("教") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("教","")
					}
					if(itme.mechanism_name.indexOf("语") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("语","")
					}
					if(itme.mechanism_name.indexOf("学") > -1){
						itme.mechanism_name = itme.mechanism_name.replace("学","")
					}
					if(itme.map != null){
						if(itme.map.masterSetPriceEntity.length == 0){
							itme.map.masterSetPriceEntity.push(data)
							itme.dis = false
						}else{
							itme.dis = true
						}
					}
					itme.juli = _this.getDistance(itme.latitude,itme.longitude,_this.weidu,_this.jingdu).toFixed(1)
				})
				if( _this.xinjifou_ke.length == 0){
					 _this.xinjifou_ke = b
				}else if(  _this.xinjifou_ke.length > 0 && b.length > 0){
					_this.xinjifou_ke = _this.xinjifou_ke.concat(b)
				}
				_this.list_jigou_huan = _this.xinjifou_ke
			},
			rad(d) {
				return d * Math.PI / 180.0; 
			},
			
			getDistance(lat1, lng1, lat2, lng2) {
				let me = this
				var radLat1 = me.rad(lat1);
				var radLat2 = me.rad(lat2);
				var a = radLat1 - radLat2;
				var b = me.rad(lng1) - me.rad(lng2);
				var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
					Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
				s = s * 6378.137; // EARTH_RADIUS;
				s = Math.round(s * 10000) / 10000; //输出为公里
				var distance = s;
				var distance_str = "";
				if (parseInt(distance) >= 1) {
					distance_str = distance.toFixed(1) + "km";
				} else {
					distance_str = distance * 1000 + "m";
				}
				return s;
			}
		}
	}
</script>
<style lang="scss" scoped>
	.bannerCla {
		width: 750rpx;
		box-sizing: border-box;
		position: absolute;
		
		text-align: center;
		height: 290rpx;
	}
	.slideDownwardClass {
		background: #FFFFFF;
		color: #FF7300;
		position: fixed;
		top: 0;
		z-index: 121212121;
		border: #F5F5F5 0.5rpx solid;
		width: 750rpx;
		box-sizing: border-box;
	}
	.slideUpClass {
		background: transparent;
		color: #FFFFFF;
		position: absolute;
		top: 97rpx;
		height: 55.36rpx;
		display:flex;
		width: 750rpx;
		align-items: center;
		box-sizing: border-box;
		padding: 0 31.44rpx;
	}
	.cllc{
		font-size: 32rpx;
		color: #FF3D3D;
		font-weight: bold;
	}
	.list{
		font-size: 25rpx;
		color: #C1C1C1;
		position: relative;
		top: 7rpx;
	}
	.huodong_img{
		width: 340rpx;
		height: 105rpx;
		vertical-align: middle;
	}
	.panduan{
		color: #BFBFBF;
		text-decoration:line-through ;
		margin-left: 10rpx;
	}
	.zhengchang{
		color:#FF3D3D;
	}
	.zhishidian{
		display: flex;
		position: absolute;
		z-index: 1212121; 
		left: 375rpx;
		top: 248rpx;
		.xia{
			display: flex;
			position: relative;
			.kuai{
				width: 30.2rpx;
				height: 7rpx;
				margin-right: 15.5rpx;
				position: relative;
				border-radius: 4rpx;
			}
		}
	}
	.bun{
		width: 26rpx;
		height: 8rpx;
		margin-right: 15rpx;
		border-radius: 4rpx;
	}
	.shouye_content{
		.tuijiankecheng{
			width: 750rpx;
			background:#FFFFFF;
			margin-top:6.03rpx;
			.tuijiankecheng_{
				box-sizing: border-box;
				padding: 21.146rpx 52.548rpx 32rpx 55.57rpx ;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
				.tuijian_xia{
					margin-top: 47.112rpx;
				}
			}
		}
		.fenlei{
			width: 750rpx;
			height: 84.56rpx;
			background: #FFFFFF;
			display: flex;
			box-sizing: border-box;
			padding:10rpx;
			.xuanze{
				width: 375rpx;
				height: 64.56rpx;
				font-size: 25.14rpx;
				text-align: center;
				line-height: 64.56rpx;
				color: #414141;
			}
		}
		.xinjihou{
			width: 700.6rpx;
			height: 485.6rpx;
			margin-left:24.77rpx ;
			background: #F2F2F2;
			border-radius: 30.2rpx;
			box-sizing: border-box;
			padding: 30.2rpx 0 36.24rpx 34.428rpx;
			margin-bottom:30.2rpx;
			.biaotix{
				display: flex;
				justify-content: space-between;
				font-weight: bold;
				letter-spacing: 1rpx;
				align-items: center;
				margin-bottom:34.43rpx;
				padding-right: 36.24rpx;
			}
			.xinjigou_{
				 display: flex;
				 overflow-y: hidden;
				 overflow-x: scroll;
				 background: #F2F2F2;
				.my_regs{
					display: flex;
				}
			}
		}
		.tupian1{
			position: absolute;
			top: 175.23rpx;
			left: 27.22rpx;
			.banner{
				width:694.6rpx;
				height:286.5rpx;
			}
		}
		.daohang{
			width: 695rpx;
			min-height: 230rpx;
			margin: 140.27rpx 0 0 27.22rpx;
			background: #FFFFFF;
			border-radius: 30.2rpx;
			padding: 41.67rpx 48.9rpx 0 48.3rpx;
			display: flex;
			justify-content: space-between;
			text-align: center;
			box-sizing: border-box;
			position:relative;
		}
		.biao{
			width: 30.2rpx;
			height: 7rpx;
			margin-right: 15.5rpx;
			background: #007AFF;
			position: absolute;
			z-index: 1212121;
		}
		.jigoure{
			width: 700.6rpx;
			min-height: 600.7rpx;
			margin:18.12rpx 0 16rpx 27.22rpx ;
			background: #FFFFFF;
			border-radius: 30.2rpx;
			box-sizing: border-box;
			padding: 30.2rpx 36.24rpx 32.6rpx 34.42rpx;
			.biaoti{
				display: flex;
				justify-content: space-between;
				font-weight: bold;
				letter-spacing: 1rpx;
				align-items: center;
				margin-bottom:34.43rpx;
			}
			.kecheng{
				display: flex;
			}
		}
	}
	.kite-classify-scroll{
		display: flex;
		align-items: center;
	    width: 100%;
		height:150rpx;;
		overflow: hidden;
	 	white-space: nowrap;
		margin: 0;
		padding: 0;
	}
	.kite-classify-cell{
		display: inline-block;
		width: 95rpx;
		height:140rpx;
		font-size: 26rpx;
		color: #FF7300;
		text-align: center;
		padding: 0;
		margin-right: 69rpx;
		
	}
	.kite-classify-scroll ::-webkit-scrollbar {
		 /* 隐藏滚动条，但依旧具备可以滚动的功能 */
		 display: none;
		 width: 0;
		 height: 0;
		 color: transparent;
		 background: transparent;
		}
	/deep/::-webkit-scrollbar {
	 display: none;
	 width: 0;
	 height: 0;
	 color: transparent;
	 background: transparent;
	}
	.tupian{
		position: relative;
		.neibu_ke{
				position: absolute;
				width: 694rpx;
				left: 27rpx;
				height: 761rpx;
				box-sizing: border-box;
				padding: 27rpx;
				background: #FFFBED;
				top: 1400rpx;
				border-radius: 30rpx;
				.biao_title{
					font-size: 32rpx;
					font-weight: bold;
					margin-bottom: 20rpx;
				}
			}
		
		.img{
			width: 750rpx;
			vertical-align: top;
		}
		.zhongjian_kuang{
			position: absolute;
			left: 33rpx;
			top: 475rpx;
			width: 685rpx;
			height: 587rpx;
			box-sizing: border-box;
			border: 10rpx solid #000000;
			border-radius: 25rpx;
			background: #FFFBED;
			padding: 35rpx;
			font-size: 30rpx;
			letter-spacing: 2rpx;
			.erwei{
				position: absolute;
				width: 170rpx;
				height: 170rpx;
				top: 310rpx;
				left: 231rpx;
			}
		}
	}
	.box_wai{
		display: flex;
		.img_huo{
			height: 40rpx;
			width: 130rpx;
		}
		.img{
			width: 170rpx;
			height: 170rpx;
			border-radius: 20rpx;
			position: relative;
			.categories_child{
				min-width: 50rpx;
				height: 38rpx;
				line-height: 38rpx;
				padding: 0 15rpx;
				font-size: 22rpx;
				background: #FF3D3D;
				text-align: center;
				border-radius: 20rpx 0 20rpx 0;
				position: absolute;
				top: 0;
				left: 0;
				color: #FFFFFF;
			}
			.vertical{
				position: absolute;
				left: 0;
				bottom: 0;
			}
		}
	}
</style>

